package cn.finder.httpcommons.response;

import cn.finder.httpcommons.attri.JsonProperty;
import cn.finder.httpcommons.domain.Message;

public  class ApiResponse {
    public ApiResponse()
    {
        message = new Message();
    }

    /// <summary>
    /// 原始文本内容体
    /// </summary>
    private String body;
    

    /// <summary>
    /// 总记录数
    /// </summary>
   
    private int count;


    /// <summary>
    /// 总页数
    /// </summary>
   
    private int pageCount;

    /// <summary>
    /// 页大小 默认为10
    /// </summary>
    private int pageSize;

    /// <summary>
    /// 页数索引 从1开始
    /// </summary>
    private int pageIndex;
    /// <summary>
    /// 总记录数
    /// </summary>
    private int totalRecord;


    /// <summary>
    /// 消息
    /// </summary>
    private Message message;

    /// <summary>
    /// 对象
    /// </summary>
   
    private Object tag;
    
    
    

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	@Deprecated
    @JsonProperty(name ="count")
	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getPageCount() {
		return pageCount;
	}

	 @JsonProperty(name="pageCount")
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(int pageIndex) {
		this.pageIndex = pageIndex;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public Message getMessage() {
		return message;
	}

	public void setMessage(Message message) {
		this.message = message;
	}

	public Object getTag() {
		return tag;
	}
	
	 @JsonProperty(name="tag")
	public void setTag(Object tag) {
		this.tag = tag;
	}
    
	 /***
	  * 判断请求是否成功 ,如果服务器U没有返回statusCode字段，那么需要自己去根据业务字段判断是否请求成功
	  * @return  if true: 请求成功  fales:请求失败
	  */
	 public boolean isSuccess(){
		 if(message.getStatusCode() ==Message.StatusCode_OK){
			 return true;
		 }
		 return false;
	 }
	 
	 
	 
	 
		

}
